async function fetchThemes() {
  const response = await fetch("https://api.mdnice.com/themes?pageSize=50&currentPage=1", {
    headers: {
      accept: "application/json, text/plain, */*",
      "accept-language": "zh-CN,zh;q=0.9",
      authorization:
        "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiJOVFkyT1RJPSIsImlzcyI6IjkwYjlhNjNjODFjYzYzNTg4NDg2IiwiaWF0IjoxNzE4NjI2OTc5LCJhdWQiOiJtZG5pY2UtYXBpIiwiZXhwIjoxNzIxMjE4OTc5LCJuYmYiOjE3MTg2MjY5Nzl9.ZrjBb1oitN64nVuXXagCesKaJ3QgPK6AVdhdkYa2RrA",
      "cache-control": "no-cache",
      pragma: "no-cache",
      "sec-ch-ua": '"Google Chrome";v="125", "Chromium";v="125", "Not.A/Brand";v="24"',
      "sec-ch-ua-mobile": "?0",
      "sec-ch-ua-platform": '"macOS"',
      "sec-fetch-dest": "empty",
      "sec-fetch-mode": "cors",
      "sec-fetch-site": "same-site",
    },
    referrer: "https://editor.mdnice.com/",
    referrerPolicy: "strict-origin-when-cross-origin",
    body: null,
    method: "GET",
    mode: "cors",
    credentials: "include",
  });

  const data = await response.json();
  const {themeList} = data.data;

  const promises = themeList.map((theme) =>
    fetch("https://api.mdnice.com/articles/styles", {
      headers: {
        accept: "application/json, text/plain, */*",
        "accept-language": "zh-CN,zh;q=0.9",
        authorization:
          "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiJOVFkyT1RJPSIsImlzcyI6IjkwYjlhNjNjODFjYzYzNTg4NDg2IiwiaWF0IjoxNzE4NjI2OTc5LCJhdWQiOiJtZG5pY2UtYXBpIiwiZXhwIjoxNzIxMjE4OTc5LCJuYmYiOjE3MTg2MjY5Nzl9.ZrjBb1oitN64nVuXXagCesKaJ3QgPK6AVdhdkYa2RrA",
        "cache-control": "no-cache",
        "content-type": "application/json;charset=UTF-8",
        pragma: "no-cache",
        "sec-ch-ua": '"Google Chrome";v="125", "Chromium";v="125", "Not.A/Brand";v="24"',
        "sec-ch-ua-mobile": "?0",
        "sec-ch-ua-platform": '"macOS"',
        "sec-fetch-dest": "empty",
        "sec-fetch-mode": "cors",
        "sec-fetch-site": "same-site",
      },
      referrer: "https://editor.mdnice.com/",
      referrerPolicy: "strict-origin-when-cross-origin",
      body: JSON.stringify({
        outId: "c7d64e87dbf147959bb5634855240061",
        themeId: theme.themeId,
      }),
      method: "PUT",
      mode: "cors",
      credentials: "include",
    })
      .then((res) => res.json())
      .then((res) => ({
        ...res.data,
        ...theme,
      })),
  );
  const result = await Promise.all(promises);

  console.log(result);
}

fetchThemes();
